package edu.fjnu.seed.controller;

import java.util.Scanner;

public class Count {
    public static void main(String Args[])
    {
        int i,j=1;
        float Number1,Number2,He,Cha,Ji,Shang;
        Scanner S = new Scanner(System.in);
        while(j==1) {
            System.out.println("请选择算数符号：1+；2-；3×；4÷；");
            i = S.nextInt();
            while(i!=1&i!=2&i!=3&i!=4)
            {
                System.out.println("输入有误，请重新选择算数符号：1+；2-；3×；4÷；");
                i = S.nextInt();
            }
            System.out.println("请输入两个数字:");
            Number1 = S.nextFloat();
            Number2 = S.nextFloat();
            switch (i) {
                case 1:
                    He = Number1 + Number2;
                    System.out.println("两个数的和为：" + He);
                    break;
                case 2:
                    Cha = Number1 - Number2;
                    System.out.println("两个数的差为：" + Cha);
                    break;
                case 3:
                    Ji = Number1 * Number2;
                    System.out.println("两个数的积为：" + Ji);
                    break;
                case 4:
                    Shang = Number1 / Number2;
                    System.out.println("两个数的商为：" + Shang);
                    break;
                default:
                    break;

            }
            System.out.println("是否继续？是：1 否：2");
            j = S.nextInt();
            while(j!=1&j!=2)
            {
                System.out.println("输入有误，请重新选择是否继续：是：1；否：2；");
                j = S.nextInt();
            }
        }
    }
}
